<?php
namespace Qy {
    /**
    * 企业微信摇一摇周边类
    * @author Jamers
    * @since 2017.1.1
    * @see http://qydev.weixin.qq.com/wiki/index.php?title=%E6%91%87%E4%B8%80%E6%91%87%E5%91%A8%E8%BE%B9
    */
    class Shake {
        private $common;
        
        public function __construct($ary = array()) {
            if (isset($ary['common'])) {
                $this->common = &$ary['common'];
            }else{
                $this->common = new \Qy\Common();
            }
        }
        /**
        * 获取设备及用户信息
        * 
        * @param mixed $ticket
        * @param mixed $a_token
        */
        public function getShakeinfo($ticket,$a_token = '') {
            if (empty($ticket)) return false;
            if (empty($a_token)) $a_token = $this->common->read_access_token();
            $data = array('ticket' => $ticket);
            $url = "https://qyapi.weixin.qq.com/cgi-bin/shakearound/getshakeinfo?access_token={$a_token}";
            return $this->common->httpRequest($url,$data,'post');
        }
    }
}